package com.xunker.appointment.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@Controller//注意不能使用RestController
public class IndexController {
    private final String LIST_INDEX="redirect:/";
    private final static String PAGE_INDEX="frame/index";
    private final static String PAGE_MAIN="frame/main";
    private final static String PAGE_LOGIN="frame/login";
    private final static String PAGE_AUTH="frame/auth";

    /**
     * 框架首页
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("/")
    public String index(ModelMap model, HttpServletRequest request){
        return PAGE_INDEX;
    }

    /**
     * 框架首页
     * @return
     */
    @GetMapping("/main")
    public String main(){
        return PAGE_MAIN;
    }

    /**
     * 框架主页
     * @return
     */
    @GetMapping("/auth")
    public String auth(){
        return PAGE_AUTH;
    }
    @GetMapping("/login")
    public String login(){
        return PAGE_LOGIN;
    }
}
